#ifndef RINGFIFO_H
#define RINGFIFO_H
#include <semaphore.h>


#define BUFFER_SIZE (10 * 1024*1024)
#define FRAME_SIZE 1024*1024
#define SHARED_MEM_NAME "/my_shared_memory"
#define SEM_MUTEX_NAME "/my_semaphore_mutex"
#define SEM_EMPTY_NAME "/my_semaphore_empty"
#define SEM_FULL_NAME "/my_semaphore_full"


typedef struct {
    char *buffer; // 假设每个元素最多256个字符
    int *in;
    int *out;
} CircularBuffer;

void create_ringfifo(CircularBuffer* cb);
void get_ringfifo(CircularBuffer* cb);
void destroy_ringfifo(CircularBuffer* cb);
void ringfifo_write(CircularBuffer* cb, const char* data,int length);
int ringfifo_read(CircularBuffer* cb, char* data,int length);
#endif